//
//  UIImage+Image.m
//  01-BuDeJie
//
//  Created by 1 on 15/12/17.
//  Copyright © 2015年 xiaomage. All rights reserved.
//

#import "UIImage+Image.h"

@implementation UIImage (Image)


+ (instancetype)imageNamedWithOriganlMode:(NSString *)imageName
{
    // 加载原始图片
    UIImage *selImage = [UIImage imageNamed:imageName];
    
    // imageWithRenderingMode:返回每一个没有渲染图片给你
    return  [selImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}


+ (UIImage *)addImage:(UIImage *)image1 toImage:(UIImage *)image2 {
    
    CGFloat width = image1.size.width / 2.0;
    CGFloat height = image1.size.height / 2.0;
    
    CGSize size = CGSizeMake(width,height);
    
    UIGraphicsBeginImageContext(size);
    
    // Draw image1
    [image1 drawInRect:CGRectMake(0, 0, width, height)];
    
    // Draw image2
    [image2 drawInRect:CGRectMake(0, 0, width, height)];
    
    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
    
    
    
    return resultingImage;
}
@end
